class Solution(object):
    def reformat(self, s):
        a = []
        b = []
        for c in s:
            if '0' <= c <= '9':
                b.append(c)
            else:
                a.append(c)
        if abs(len(a) - len(b)) > 1:
            return ''
        if len(a) < len(b):
            a, b = b, a
        t = ''
        m1 = len(a)
        m2 = len(b)
        index = 0
        while index < m1 and index < m2:
            t += a[index]
            t += b[index]
            index += 1
        if index < m1:
            t += a[index]
        return t
